#include "MainWindow.h"
#include "components/ImagaeParametersPanel.h"
#include "components/ProjectPanel.h"
#include "components/MainImagePanel.h"
#include "components/ImageOperationPanel.h"
#include "components/NavigationMapPanel.h"
#include <QGridLayout>
#include <QLabel>
#include <QProcess>
#include <QProgressBar>
#include "components/StatusBar.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
	setupUi();
}

MainWindow::~MainWindow() {}


void MainWindow::initComponents()
{
    auto imageParameterPanel = new ImagaeParametersPanel();
    auto projectPanel = new ProjectPanel();
    auto navigatePanel = new NavigationMapPanel();
    auto mainImage = new MainImagePanel();
    auto imageOperationPanel = new ImageOperationPanel();
    auto progressBar = new StatusBar();
    auto layout = new QGridLayout();


    projectPanel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    imageParameterPanel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    imageOperationPanel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
    navigatePanel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
    mainImage->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    layout->addWidget(mainImage, 0, 0, 4, 1);
    layout->addWidget(projectPanel, 0, 1, 1, 1);
    layout->addWidget(navigatePanel, 2, 1, 1, 1);
    layout->addWidget(imageOperationPanel,1,1,1,1);
    layout->addWidget(progressBar,3,1,1,1);

    auto centralWidget = new QWidget();
	centralWidget->setLayout(layout);
	setCentralWidget(centralWidget);
}

void MainWindow::setupUi()
{
	initComponents();

    setMinimumSize(QSize(1600,800));
}
